home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
xlibpas2.zip
/
XBM2.DOC
< prev
next >
Wrap
Text File
|
1994-06-12
|
20KB
|
438 lines
╔═══════════════════════════════════════════════════════════════════════════╗
║ ║
║ XLIB v2.0 - Graphics Library for Borland/Turbo Pascal 7.0 ║
║ ║
║ Tristan Tarrant - tristant@cogs.susx.ac.uk ║
║ ║
╠═══════════════════════════════════════════════════════════════════════════╣
║ ║
║ Credits ║
║ ║
║ Themie Gouthas ║
║ ║
║ Matthew MacKenzie ║
║ ║
║ Tore Bastiansen ║
║ ║
║ Andy Tam ║
║ ║
║ Douglas Webb ║
║ ║
║ John Schlagel ║
║ ║
╠═══════════════════════════════════════════════════════════════════════════╣
║ ║
║ I informally reserve all rights to the code in XLIB ║
║ Rights to contributed code is also assumed to be reserved by ║
║ the original authors. ║
║ ║
╚═══════════════════════════════════════════════════════════════════════════╝
╔═══════════════════════════════════════════════════════════════════════════╗
║ DISCLAIMER ║
╚═══════════════════════════════════════════════════════════════════════════╝
This library is distributed AS IS. The author/s specifically disclaim any
responsibility for any loss of profit or any incidental, consequential or
other damages.
╔═══════════════════════════════════════════════════════════════════════════╗
║ XBM2 : EXPORTED PROCEDURES AND FUNCTIONS ║
╚═══════════════════════════════════════════════════════════════════════════╝
This unit implements a set of functions to operate on bitmaps. XLIB2 uses
three different kinds of bitmaps :
Planar Bitmaps (PBMs),
Video Bitmaps (VBMs),
Compiled Bitmaps (CBMs).
╔═══════════════════════════════════════════════════════════════════════════╗
║ PBMs : EXPORTED PROCEDURES AND FUNCTIONS ║
╚═══════════════════════════════════════════════════════════════════════════╝
PBMs as used by these functions have the following structure:
byte 0 The bitmap width in bytes (4 pixel groups) range 1..255
byte 1 The bitmap height in rows range 1..255
byte 2..n1 The plane 0 pixels width*height bytes
byte n1..n2 The plane 1 pixels width*height bytes
byte n2..n3 The plane 2 pixels width*height bytes
byte n3..n4 The plane 3 pixels width*height bytes
These functions provide the fastest possible bitmap blts from system ram
to video and further, the single bitmap is applicable to all pixel
alignments. The masked functions do not need separate masks since all non
zero pixels are considered to be masking pixels, hence if a pixel is 0 the
corresponding screen destination pixel is left unchanged.
xputmaskedpbm
-------------
Procedure xputmaskedpbm( X, Y, ScrnOffs : word; var Bitmap);
Mask write a planar bitmap from system ram to video ram. All zero source
bitmap bytes indicate destination byte to be left unchanged.
Source Bitmap structure:
Width:byte, Height:byte, Bitmap data (plane 0)...Bitmap data (plane 1)..,
Bitmap data (plane 2)..,Bitmap data (plane 3)..
NOTE: width is in bytes ie lots of 4 pixels
LIMITATIONS: No clipping is supported
Only supports bitmaps with widths which are a multiple of
4 pixels
xputpbm
-------
Procedure xputpbm( X, Y, ScrnOffs : word; var Bitmap );
Write a planar bitmap from system ram to video ram.
Source Bitmap structure:
Width:byte, Height:byte, Bitmap data (plane 0)...Bitmap data (plane 1)..,
Bitmap data (plane 2)..,Bitmap data (plane 3)..
NOTE: width is in bytes ie lots of 4 pixels
LIMITATIONS: No clipping is supported
Only supports bitmaps with widths which are a multiple of
4 pixels
xgetpbm
-------
Procedure xgetpbm( X, Y : word; Bw, Bh : byte; ScrnOffs : word;
var Bitmap );
Read a planar bitmap to system ram from video ram.
Source Bitmap structure:
Width:byte, Height:byte, Bitmap data (plane 0)...Bitmap data (plane 1)..,
Bitmap data (plane 2)..,Bitmap data (plane 3)..
NOTE: width is in bytes ie lots of 4 pixels
LIMITATIONS: No clipping is supported
Only supports bitmaps with widths which are a multiple of
4 pixels
A similar set of functions have been implemented to operate on planar
bitmaps but incorporating clipping to a user defined
clipping rectangle (which is set by xsetcliprect )
There are three variations of the normal functions in this unit
identified by the three function name extensions: clipx, clipy clipxy.
Because speed is critical in games programming you do not want to be
checking for clipping if not necessary thus for sprites that move only
horizontally you would use the clipx version of the put function,
for sprites that move vertically you would use the clipy version and for
sprites that move both directions you would use the clipxy version.
Keep in mind also that the clipping components of these functions assume
that the clipping rectangle is equal to or larger than the size of the
bitmap ie. if a bitmap is top clipped, it is assumed that the bitmap's
bottom is not also clipped. Similarly with horizontal clipping.
Note: performance in decreasing order is as follows.
clipy,clipx,clipxy with masked puts being slower than unmasked puts
Horizontal clipping is performed to byte boundaries (4 pixels) rather than
pixels. This allows for the fastest implementation of the functions. It is
not such a handicap because for one, your screen width a multiple of 4
pixels wide and for most purposes it is the screen edges that form the
clipping rectangle.
Following is an example of setting a clipping rectangle to the logical
screen edges:
xsetcliprect(0,0,ScrnLogicalByteWidth,ScrnLogicalHeight)
NOTE: the functions now return a value;
1 if clipped image is fully clipped (ie no portion of it
appears on the screen) otherwise it returns 0
xputpbmclipx
------------
xputpbmclipy
------------
xputpbmclipxy
-------------
xputmaskedpbmclipx
------------------
xputmaskedpbmclipy
------------------
xputmaskedpbmclipxy
-------------------
For a detailed description of parameters etc. see equivalent functions
xputpbm, xputmaskedpbm
╔═══════════════════════════════════════════════════════════════════════════╗
║ CBMs : EXPORTED PROCEDURES AND FUNCTIONS ║
╚═══════════════════════════════════════════════════════════════════════════╝
o xcompilebitmap compiles your bitmap into native code which